package cn.z2huo.algorithm.fibonacci;

import java.util.Scanner;

/**
 * 使用迭代的方式计算斐波那契数列
 * @author zyz
 *
 */
public class Main {

	public static void main(String[] args) {
		long a = 1;
		long b = 1;
		long m;
		long n;
		System.out.println("请输入要计算的数列的位数：");
		Scanner sc = new Scanner(System.in);
		n = sc.nextLong();
		sc.close();
		for (int i=0; i<n; i++) {
			if (i==0 || i==1) {
				System.out.println(1);
			}else {
				m = a+b;
				System.out.println(m);
				a = b;
				b = m;
			}
		}
	}
}